package cn.tedu.egcar1.controller;

import cn.tedu.egcar1.base.response.JsonResult;
import cn.tedu.egcar1.mapper.UserMapper;
import cn.tedu.egcar1.pojo.dto.UserLoginParam;
import cn.tedu.egcar1.pojo.dto.UserRegParam;
import cn.tedu.egcar1.pojo.entity.User;
import cn.tedu.egcar1.pojo.vo.UserVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpSession;
import java.util.Date;

@RestController
@RequestMapping("/v1/user/")
@Slf4j
@Api(tags = "01.用户控制模块")
public class UserController {
    @Autowired
    public UserMapper userMapper;

    @PostMapping("reg")
    @ApiOperation("注册用户")
    @ApiOperationSupport(order = 10)
    public JsonResult RegUser(@RequestBody UserRegParam userRegParam){
        log.debug("userRegParam:"+userRegParam);
        User user = new User();
        BeanUtils.copyProperties(userRegParam,user);
        user.setId(1L);
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());

        log.debug("userRegParam"+userRegParam);

        userMapper.regUser(user);

        return JsonResult.success();
    }
}
